package com.File;

import org.junit.jupiter.api.Test;

import java.io.File;
import java.io.IOException;

public class FileCreate {
    public static void main(String[] args) {

    }
    @Test
    public void create01(){
        String filePath = "d:\\JavaFile\\news1.txt";
        File file = new File(filePath);
        try {
            file.createNewFile();
            System.out.println("ok");
        } catch (IOException e) {
            e.printStackTrace();
        }
    }
    @Test
    public void create02(){
        File file = new File("d:\\");
        String fileName = "news.txt";
        File file1 = new File(file,fileName);
        try {
            file1.createNewFile();
        } catch (IOException e) {
            e.printStackTrace();
        }
    }
    public void create03(){
        File parentPath = new File("d:\\");
        String filePath = "news.txt";
        File file1 = new File(parentPath,filePath);
        try {
            file1.createNewFile();
        } catch (IOException e) {
            e.printStackTrace();
        }
    }
}
